import React, { useMemo } from 'react'
import { Button } from 'antd'
import styles from './index.less'
interface IProps {
  onClick: () => void
}

export const BComponent: React.FC<IProps> = React.memo((props): JSX.Element => {
  const { onClick } = props

  const handleClick = useMemo(
    () => (): void => {
      onClick?.()
    },
    [onClick]
  )

  console.log('b is update!')
  return (
    <div style={styles.items}>
      <Button onClick={handleClick} type="primary">
        click me
      </Button>
    </div>
  )
})
